import { Component } from '@angular/core';
import { NavController, NavParams,ModalController,AlertController,ViewController } from 'ionic-angular';
import { TaskSelectPage } from '../task-select/task-select';

@Component({
  selector: 'page-add',
  templateUrl: 'add.html',
})
export class AddPage {
  TaskSelectPage : any = TaskSelectPage;
  obj: any = {};
  constructor(public navCtrl: NavController, public navParams: NavParams,public modalCtrl:ModalController,private alertCtrl: AlertController,public viewCtrl: ViewController) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad Add');
  }
  dismiss(){
  this.viewCtrl.dismiss()
}
 selectCover() {
    let modal = this.modalCtrl.create(this.TaskSelectPage, {
      title: "选择任务分类",
      className: "Department",
      equalTo: [
        { key: "type", value: "school" },
      ]
    })
    modal.onDidDismiss(data => {
      if (data) {
        this.obj.parent = data
      }
    })
    modal.present()
  }
  presentConfirm() {
  let alert = this.alertCtrl.create({  
    message: '退出此次编辑?',
    buttons: [
      {
        text: '取消',
        role: 'cancel',
        handler: () => {
        }
      },
      {
        text: '确定',
        handler: () => {
          this.dismiss()
        }
      }
    ]
  });
  alert.present();
}

}
